<template>
  <div class="basic-container"
       :class="{'basic-container--block':block}">
    <el-card :style="{height:title===''?'100%':''}">
      <div class="___title" v-if="title!==''">
        <div>
          <h3 v-if="title!==''">{{ title }}</h3>
          <div class="slot">
            <slot name="right"/>
          </div>
        </div>
      </div>
      <div>
        <slot></slot>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'basicContainer',
  props: {
    radius: {
      type: [String, Number],
      default: 10
    },
    title: {
      type: String,
      default: ''
    },
    background: {
      type: String
    },
    block: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    styleName () {
      return {
        borderRadius: this.setPx(this.radius),
        background: this.background
      }
    }
  }
}
</script>

<style lang="scss">
.basic-container {
  padding: 10px 6px;
  box-sizing: border-box;

  &--block {
    height: 100%;

    .el-card {
      height: 100%;
    }
  }

  .el-card {
    width: 100%;
  }

  &:first-child {
    padding-top: 0;
  }

  .___title {

    > div {
      height: 26px;
      border-bottom: 1px solid #e9e9e9;
      padding: 0 0 10px 0;
      margin: 0 0 10px;
      width: 100%;
      flex-direction: row;
      display: flex;
      align-items: baseline;

      > h3 {
        margin: 0;
        padding: 0;
      }

      .slot {
        margin-left: 10px;
      }
    }
  }
}
</style>
